<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" scope="request"/>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" href="<c:url value='/resources/styles/main.css' />" type="text/css"/>
    <script type="text/javascript" src="<c:url value='/resources/scripts/datePicker/WdatePicker.js' />"></script>
    <script type="text/javascript">
        var contextPath = '${ctx}/';
        function deleteDate(id){

            if(window.confirm("确定要删除吗？"))
            {
                window.location.href=contextPath+'/admin/calendar/deleteCalendar.do?id='+id;
            }

            <%----%>
        }
    </script>
    <title>日程列表</title>
</head>
<body>
<table class="header">
    <tr>
        <td>
            <h1>日程列表</h1>
        </td>
    </tr>
</table>
<table class="pagination" style="padding-left: 70px;">
    <tr>
        <td>
            <a href="<c:url value="/admin/calendar/addCalendar.do" />">新建日程</a>
        </td>
        <td>
            <form method="post" action="<c:url value='/admin/calendar/listCalendar.do'/>" >

                会议日期：&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" id="day" name="day" value="${day}"  class="Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd ', readOnly:true})"/>
                <input type="submit" value="搜索"/>
            </form>
        </td>
    </tr>
</table>

<table class="list">
    <tr>
        <th>日期</th>
        <th>主题—上午</th>
        <th>主题—中午</th>
        <th>主题—下午</th>
        <th>主题—晚上</th>
        <th>删除</th>
    </tr>
    <c:choose>
        <c:when test="${totalCount > 0}">
            <c:forEach var="item" items="${results}">
                <tr>
                        <%--<td><input type="checkbox" class="itemId" value="${item.id}" /></td>--%>

                    <td><a href="<c:url value='/admin/calendar/viewCalendar.do?id=${item.id}'/>">
                        <fmt:formatDate value="${item.day}" pattern="yyyy-MM-dd"></fmt:formatDate>
                    </a></td>
                    <%--<td>${item.amIcon}</td>--%>
                    <%--<td>${item.amIconToday}</td>--%>
                    <td>${item.amTopic}</td>
                    <%--<td>${item.amTime}</td>--%>

                            <%--<td>${item.noonIcon}</td>--%>
                            <%--<td>${item.noonIconToday}</td>--%>
                            <td>${item.noonTopic}</td>
                            <%--<td>${item.noonTime}</td>--%>

                            <%--<td>${item.pmIcon}</td>--%>
                            <%--<td>${item.pmIconToday}</td>--%>
                            <td>${item.pmTopic}</td>
                            <%--<td>${item.pmTime}</td>--%>

                            <%--<td>${item.nightIcon}</td>--%>
                            <%--<td>${item.nightIconToday}</td>--%>
                            <td>${item.nightTopic}</td>
                            <%--<td>${item.nightTime}</td>--%>
                    <td>
                        <%--<a href="<c:url value='/admin/calendar/deleteCalendar.do?id=${item.id}'/>">删除</a>--%>
                        <a href="#"  onclick="deleteDate('${item.id}');">删除</a>
                    </td>
                </tr>
            </c:forEach>
        </c:when>
        <c:otherwise>
            <tr>
                <td colspan="17">没有数据</td>
            </tr>
        </c:otherwise>
    </c:choose>

</table>
</body>
</html>